import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
import { Mentions as AntdMentions } from 'antd';
import React from 'react';
import createField from '../../createField';
import useOptions from '../../hooks/useOptions';
var _excluded = ['options', 'children'];
var Mentions = function Mentions(_ref) {
  var optionsProp = _ref.options,
    children = _ref.children,
    rest = _objectWithoutProperties(_ref, _excluded);
  var _useOptions = useOptions(optionsProp || []),
    options = _useOptions.options;
  return /*#__PURE__*/ React.createElement(
    AntdMentions,
    _objectSpread({}, rest),
    children
      ? children
      : options.map(function (option) {
          return /*#__PURE__*/ React.createElement(
            AntdMentions.Option,
            {
              key: option.value,
              value: option.value,
            },
            option.label,
          );
        }),
  );
};
var FinalMentions = createField(Mentions);
FinalMentions.Option = AntdMentions.Option;
export default FinalMentions;
